using Nop.Core.Domain.Customers;
using System;
using System.Collections.Generic;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Nop.Data.Mapping.Customers
{
	public class ClubMembershipMap : EntityTypeConfiguration<ClubMembership>
	{
		public ClubMembershipMap()
		{
			this.ToTable("ClubMembership");
			this.HasKey(cm => cm.Id);			
			this.HasRequired(cm => cm.CustomerRole).WithMany().HasForeignKey(cm => cm.CustomerRoleId);
			this.HasOptional(cm => cm.ProductVariant).WithMany().HasForeignKey(cm => cm.ProductVariantId);

			this.Property(cm => cm.Name).HasMaxLength(50).IsRequired();
			this.Property(cm => cm.SystemName).HasMaxLength(50).IsRequired();
			this.Property(cm => cm.Description).HasMaxLength(4000).IsOptional();
			this.Property(cm => cm.LocalShipmentFee).HasPrecision(18, 2).IsRequired();
			this.Property(cm => cm.MembershipDuration).IsRequired();			
		}
	}
}
